<template>
    <view class="weixin">
        <u-image
            width="250rpx"
            height="190rpx"
            :src="require('@/static/images/success.png')"
        ></u-image>
        <view class="font">{{ text }}</view>
        <edu-button type="primary" size="mini" @click="onBack"
            >返回上一页
        </edu-button>
    </view>
</template>

<script>
// 此页面用于h5微信提现
export default {
    data() {
        return {
            options: {},
            text: "",
        };
    },
    // 监听页面返回
    onBackPress(options) {
        if (options.from === "navigateBack") {
            return false;
        }
        this.onBack();
        return true;
    },
    onLoad(options) {
        this.options = options;
        this.getOpen();
    },
    methods: {
        getOpen() {
            this.$edu.api
                .getEncashment({
                    order: this.options.order,
                    code: this.options.code,
                })
                .then((res) => {
                    this.text = res.msg;
                    setTimeout(() => {
                        this.onBack();
                    }, 3000);
                })
                .catch((res) => {
                    this.text = res.msg;
                    setTimeout(() => {
                        this.onBack();
                    }, 3000);
                });
        },
        onBack() {
            this.$u.route({
                type: "redirectTo",
                url: "/pageUser/user/income",
            });
        },
    },
};
</script>
<style lang="scss">
page {
    background-color: #ffffff;
}
</style>
<style lang="scss" scoped>
.weixin {
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    .font {
        font-size: 16px;
        font-weight: 400;
        color: #303133;
        line-height: 25px;
        margin-top: 40px;
        margin-bottom: 40px;
    }
}
</style>
